<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{completed:item.isShow}" v-for='(item,index) in newlist' :key="index">
      <div class="view">
        <input class="toggle" type="checkbox" v-model="item.isShow" @click="finishFn(index)"/>
        <label>{{ item.name }}</label>
        <button class="destroy" @click="delFn(index)"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
export default {
  props:['newlist'],
  data(){
    return{
      toggle:false,
      active:''
    }
  },
  methods:{
    delFn(index){
      this.$store.commit('delTasklist', index)
    },
    finishFn(index){
      this.newlist[index].isShow = !this.newlist[index].isShow
    }
  },

}
</script>
